<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CrateAppUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('app_users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->timestamp('email_verified_at')->nullable();
            $table->string('email')->comment('会员账号');
            $table->string('password')->comment('密码');
            $table->unsignedBigInteger('level_id')->nullable()->comment('会员等级');
            $table->string('uuid')->comment('设备号');
            $table->string('expires')->nullable()->comment('到期时间');
            $table->rememberToken();
            $table->timestamps();
        });

        Schema::create('levels', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->comment('等级名称');
            $table->unsignedBigInteger('weight')->default(0)->comment('等级');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('app_users');
        Schema::dropIfExists('levels');
    }
}
